﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WebShopData;


namespace AdminTools
{
    public partial class ArticleAddForm : Form
    {
        public ArticleAddForm()
        {
            InitializeComponent();
        }

        private void buttonAddArticle_Click(object sender, EventArgs e)
        {
            string text = textBoxText.Text;
            double unitPrice = double.Parse(textBoxUnitPrice.Text);
            int affectedRows = WebShopDal.InsertArticle(text, unitPrice);

            if (affectedRows > 0)
                MessageBox.Show("Article added successfully!");
            else
                MessageBox.Show("Something went wrongerino!");
        }
    }
}
